-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Site editor: fix nav error due to lack of context provider in narrow viewports #68907
base: trunk
Are you sure you want to change the base?
Conversation
Size Change: -4 B (0%) Total Size: 1.84 MB
ℹ️ View Unchanged
|
Flaky tests detected in d6f7eb1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/13001678840
|
Thanks for the PR! I think this PR is working fine and ready to ship, what do you think? I'm thinking of an alternative approach, wrapping diffdiff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js
index a5e14f0be8..b31f691ee7 100644
--- a/packages/edit-site/src/components/layout/index.js
+++ b/packages/edit-site/src/components/layout/index.js
@@ -163,7 +163,7 @@ function Layout() {
{ isMobileViewport && areas.mobile && (
<div className="edit-site-layout__mobile">
- { canvas !== 'edit' && (
+ { canvas !== 'edit' ? (
<SidebarContent routeKey={ routeKey }>
<SiteHubMobile
ref={ toggleRef }
@@ -171,9 +171,13 @@ function Layout() {
isResizableFrameOversized
}
/>
+ <ErrorBoundary>
+ { areas.mobile }
+ </ErrorBoundary>
</SidebarContent>
+ ) : (
+ <ErrorBoundary>{ areas.mobile }</ErrorBoundary>
) }
- <ErrorBoundary>{ areas.mobile }</ErrorBoundary>
</div>
) } However, some CSS tweaks might be required, e.g. Pages screen: What do you think about this approach? However, this approach is primarily intended to limit the scope of coverage for the context provider, and I have no strong opinion regarding this approach. |
P.S. After this PR is merged, I plan to fix the missing horizontal spacing in the mobile layout. At that time, I may make some adjustments to the DOM structure of the |
What?
Avoids a non-fatal error being logged in the console when navigating the site editor in narrow viewports.
The changes here were a quick take on this and there certainly may be a better solution.
Why?
To keep the console logs clean. Resolves #68929
How?
Moves the context provider that’s missing in the narrow viewport out/up in the tree so it’s a available for the mobile route area.
Testing Instructions